//translucent //Answer：SG fresnel intensity group  
//intersect highLight depth ball and depth intersect where from depth
// urp scene check depth Texture true
//depthBall - otherObjDepth
//SG-SceneDepth Linear 【Eye】 Raw  
//ScreenPos【Raw】 xyzw means xyz is（projectScreen） position and w is depth
//  distance =  SceneDepth[eye] - screenPos.w 
//unity reverse depth near0.0 far1.0,but unity has reverse-Z, near become 1.0,far become 0.0
//rimLight
//distort

Shader "Custom/energyBall"
//最基础的透明
{
    Properties
    {
      _Color ("Color", Color) = (1,1,1,0.5) // 设置默认透明度
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.5
        _Metallic ("Metallic", Range(0,1)) = 0.0
        _FurLength ("Fur Length", Range(0.001, 1)) = 0.05
        _RimColor ("Rim Color", Color) = (0,0.5,1,0.5) // 边缘光颜色
        _RimPower ("Rim Power", Range(0.1,8.0)) = 3.0 // 边缘光强度
    }

    SubShader
    {
        Tags { "RenderType"="Transparent" "Queue"="Transparent" }
        LOD 200

        // 基本渲染
        CGPROGRAM
        #pragma surface surf Standard fullforwardshadows alpha:fade
        #pragma target 3.0

        sampler2D _MainTex;

        struct Input
        {
            float2 uv_MainTex;
        };

        half _Glossiness;
        half _Metallic;
        fixed4 _Color;

        void surf (Input IN, inout SurfaceOutputStandard o)
        {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            o.Metallic = _Metallic;
            o.Smoothness = _Glossiness;
            o.Alpha = c.a;

             // RimLight
            half rim = saturate(dot(normalize(IN.viewDir), o.Normal));
            rim = pow(1.0 - rim, _RimPower);
            o.Emission = _RimColor.rgb * rim * _RimColor.a;
        }
        ENDCG

        
    }

    FallBack "Diffuse"
}